﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Willson.JsbManager.UI
{
    public partial class SelectYearMonthForm : Form
    {
        private BaseForm form = null;
        bool bClose = false;
        
        public SelectYearMonthForm(BaseForm form)
        {
            InitializeComponent();

            this.form = form;
        }

        private void button_ok_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(comboBox_year.Text) || string.IsNullOrEmpty(comboBox_month.Text))
                form.SelectYearMonth(0, 0);
            else
                form.SelectYearMonth(Convert.ToInt32(comboBox_year.Text), Convert.ToInt32(comboBox_month.Text));

            bClose = true;

            Close();
        }

        private void SelectYearMonthForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (bClose)
                e.Cancel = false;
            else
                e.Cancel = true;
        }

    }
}
